<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台管理系统</title>
    <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/font-awesome/css/font-awesome.css">
    <link rel="stylesheet" href="less/index.css">


</head>
<body>
<!-- 登录 -->
<div class="login" id="app">
    <div class="login-wrap">
        <div class="avatar">
            <img src="images/cart_logo.jpg" class="img-circle" alt="">
        </div>
        <form action="" class="col-md-offset-1 col-md-10">
            <div class="input-group input-group-lg">
                    <span class="input-group-addon">
                        <i class="fa fa-user"></i>
                    </span>
                <input type="text" class="form-control"     v-model="username" id="username" placeholder="用户名" >
            </div>
            <div class="input-group input-group-lg">
                    <span class="input-group-addon">
                        <i class="fa fa-key"></i>
                    </span>
                <input type="password" class="form-control" v-model="password" id="password" placeholder="密码">
            </div>
            <button type="button" @click="click1" class="btn btn-lg btn-primary btn-block">登 录</button>
        </form>
    </div>
</div>
<!--jQuery-->
<script src="assets/jquery/jquery.min.js"></script>
<!--bootstrap 的核心文件.-->
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="js/vue-2.6.12.js"></script>
<script src="js/axios-0.21.0.js"></script>
<script src="js/qs-6.9.4.js"></script>

<script>
    new Vue({
        el:'#app',
        data:{
            username:"",
            password:""
        },
        methods:{
            click1:function(){
                location.href = 'index.html'
                axios.post('/employee/login',Qs.stringify({
                    username:this.username,
                    password:this.password
                })).then(resp=>{
                    if(resp.data.error){
                        alert('系统异常')
                        return
                    }

                    if(resp.data.success){
                        location.href = 'index.html'
                    }else{
                        alert('用户名或者密码错误')
                    }
                })
            }
        }
    })
</script>

</body>
</html>